package com.ybox.crawler.domain.pojos;

import com.ybox.common.core.text.ZipUtils;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;

/**
 * 文章
 */
@Data
public class ClNews {
    private Integer id;
    private Integer taskId;
    private String url;
    private String title;
    private String name;
    private int type;
    private String labels;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date originalTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    private Date submitedTime;
    private Byte status;
    private Date publishTime;
    private String reason;
    private String articleId;
    private Integer no;
    private String content;
    private String labelIds;

    public String getUnCompressContent() {
        if (StringUtils.isNotEmpty(content)) {
            return ZipUtils.gunzip(content);
        }
        return content;
    }
}